<?php
$this->breadcrumbs=array(
	$title,
);?>
<h3 class="pageTitle"><?php echo $title; ?></h3>
<?php if(count($items) > 0) : ?>
    <span>
        <?php foreach($configs as $config): ?>
            <?php echo '<b>'.$config['name'].'</b>:&nbsp;'.'<span style="color:'.$config['displayColor'].'">'.$config['displayColor'].'</span>&nbsp;&nbsp;'; ?>
        <?php endforeach; ?>
    </span>
	<table>
		<thead>
			<tr>
				<th>Name</th>
				<th>Biz Rule</th>
				<th>Data</th>
			</tr>
		</thead>
		<tbody>
			<?php foreach($items as $item): ?>
				<?php //var_dump($item->authItemChildren); ?>
				<tr>
					<td style="color:<?php echo $configs[$item->type]['displayColor']; ?>">
                        <?php echo CHtml::link($item->name ,
                                                       array('authItem/edit', 'name' => $item->name),
                                                       array('class' => $configs[$item->type]['displayColor'])); ?>

                    </td>
					<td><?php echo $item->bizrule; ?></td>
					<td><?php echo $item->data; ?></td>
				</tr>
				<?php if($item->authItemChildren and count($item->authItemChildren)): ?>
					<?php foreach($item->authItemChildren as $child) : ?>
                        <tr>
                            <td style="color:<?php echo $configs[$child->child0->type]['displayColor']; ?>">
                                &nbsp;&nbsp;&nbsp;&nbsp;
                                <?php echo CHtml::link($child->child0->name ,
                                                       array('authItem/edit', 'name' => $child->child0->name),
                                                       array('class' => $configs[$child->child0->type]['displayColor'])); ?>
                            </td>
                            <td><?php echo $child->child0->bizrule; ?></td>
                            <td><?php echo $child->child0->data; ?></td>
                        </tr>
					<?php endforeach; ?>
				<?php endif; ?>
			<?php endforeach; ?>
		</tbody>
		<tfoot>
			<tr>
				<th>Name</th>
				<th>Biz Rule</th>
				<th>Data</th>
			</tr>
		</tfoot>
	</table>
<?php else: ?>
	<?php echo MyCHtml::message('test'); ?>
<?php endif; ?>
<div class="toolbar">
    <button onclick="window.location='<?php echo $this->createAbsoluteUrl('authItem/add'); ?>'" class="button">Add</button>
</div>
